<template>
  <el-card shadow="never">
    <el-form :inline="true" :model="queryForm" label-width="100">
      <el-form-item label="申报通知名称">
        <el-input v-model="queryForm.user" style="width: 300px;" clearable/>
      </el-form-item>
      <el-form-item label="发文单位">
        <el-select
            v-model="queryForm.region"
            clearable
            style="width: 300px;"
        >
          <el-option v-for="(item,index) in ['人社局','科技局','商务局','经信局','其他']" :label="item" :value="index"/>
        </el-select>
      </el-form-item>
      <el-form-item label="申报状态">
        <el-select
            v-model="queryForm.bao"
            clearable
            style="width: 300px;"
        >
          <el-option v-for="(item,index) in ['申报中','未启动','已截止']" :label="item" :value="index"/>
        </el-select>
      </el-form-item>
      <el-form-item label="政策方向">
        <el-select
            v-model="queryForm.fang"
            clearable
            style="width: 300px;"
        >
          <el-option v-for="(item,index) in ['创新企业','企业','住房保障','人才','土地','产业','税收']" :label="item"
                     :value="index"/>
        </el-select>
      </el-form-item>
      <el-form-item label="申报时间">
        <el-date-picker
            v-model="queryForm.date"
            type="date"
            style="width: 300px;"
        />
        <el-form-item>
        </el-form-item>
        <el-button type="primary" @click="onSubmit">查询</el-button>
        <el-button type="primary" plain @click="onSubmit">上传申报通知</el-button>
      </el-form-item>
    </el-form>
  </el-card>
  <br>
  <el-table :data="policy2MatchData" :header-cell-style="{ background: '#2758bb', color: '#ffffff' }"
            :row-class-name="tableRowClassName">
    <el-table-column type="index" label="序号" width="60"/>
    <el-table-column prop="policyName" label="申报通知名称"/>
    <el-table-column prop="policySource" label="发文单位" width="200"/>
    <el-table-column prop="applyDate" label="申报时间" align="center" width="200"/>
    <el-table-column prop="policyTheme" label="政策方向" align="center" width="300"/>
    <el-table-column prop="collectType" label="政策状态" align="center" width="100">
      <template #default="scope">
        已截止
      </template>
    </el-table-column>
    <el-table-column label="操作" align="center" width="100">
      <template #default="scope">
        <el-link type="warning" style="margin-right: 15px">编辑</el-link>
        <el-link type="danger">删除</el-link>
      </template>
    </el-table-column>
  </el-table>
  <div class="table-footer">
    <el-pagination background layout="prev, pager, next" :total="1000"/>
  </div>
</template>

<script setup>
import {reactive} from 'vue'
import {policy2MatchData} from '../data/data.js'

const queryForm = reactive({
  user: '',
  region: 0,
  bao: 0,
  fang: 0
})

const onSubmit = () => {
  console.log('submit!')
}
const tableRowClassName = ({row, rowIndex}) => {
  if (rowIndex % 2 === 0) {
    return ''
  } else {
    return 'warning-row'
  }
}
</script>


<style scoped lang="scss">
.table-footer {
  padding: 20px;
  background-color: #ffffff;
  display: flex;
  justify-content: right;
}

::v-deep {
  .warning-row {
    --el-table-tr-bg-color: #e6f3ff;
  }
}
</style>
